<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>AIC价格走势图</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<!--标准mui.css-->
		<link rel="stylesheet" href="../css/mui.min.css">
		<link rel="stylesheet" href="../css/common.css" />
		<!--App自定义的css-->
		<!-- <link rel="stylesheet" type="text/css" href="../css/app.css" /> -->
		<style>
			[v-cloak] {
				display: none;
			}
			
			.chart {
				height: 200px;
				margin: 0px;
				padding: 0px;
			}
			
			h5 {
				margin-top: 30px;
				font-weight: bold;
			}
			
			h5:first-child {
				margin-top: 15px;
			}
			
			.mui-bar-nav {
				background: #27CDDB;
			}
			
			.mui-action-back,
			.mui-title,
			.mui-action-back:active {
				color: #FFFFFF;
			}
			
			.quotes {
				width: 100%;
				height: 60px;
				border-top: 1px solid #dadada;
				border-bottom: 1px solid #dadada;
				background: #fff;
				padding: 0px 0px;
				margin-top: 0px;
			}
			
			.highcharts-axis-resizer {
				stroke: #eee;
			}
			
			.highcharts-axis-resizer:hover {
				stroke: #ccc;
			}
		</style>
		<script src="../js/mui.min.js"></script>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">AIC价格走势图</h1>
		</header>
		<div class="mui-content" style="background-color: #313132;" id="aicVue" v-cloak>
			<!-- 行情 -->
			<div class="quotes">
				<p id="currentPrice">￥{{priceBook.closePrice}}</p>
				<p>
					<span>
            高：<s>{{priceBook.highPrice}}</s>  <br/>  
      	    低：<s>{{priceBook.lowPrice}}</s>
      		</span>
					<span>
            量：<s>{{priceBook.vol}}</s>  <br/>  
      	    幅：<s>{{priceBook.rise * 100}}%</s>
      		</span>
				</p>
			</div>
			<div id="container" style="height:400px"></div>
		</div>

		<script src="../js/jquery-1.8.3.min.js"></script>
		<script src="../libs/highstock.js"></script>
		<script src="../libs/highcharts-zh_CN.js"></script>
		<script type="text/javascript" src="../js/vue.min.js"></script>
		<script type="text/javascript" src="../js/public.js"></script>
		<script>
			mui.init();
			var vm = new Vue({
				el: '#aicVue',
				data: {
					priceBook: {}
				},
				mounted: function() {
					mui.plusReady(function() {
						vm.priceBook = JSON.parse(plus.storage.getItem("priceBook"));
					});
				},
				methods: {}
			});
			mui.plusReady(function() {
				mui.postJSON(PriceChart, {}, function(result) {
					if(result.code != 0) {
						alert('读取数据失败！');
						return false;
					}
					var data = [];
					mui.each(result.list, function(i, item) {
						data.push([item.formatTime, item.closePrice]);
					});
					Highcharts.setOptions({　　
						global: {　　　　
							timezoneOffset: -8 * 60
						}
					});
					Highcharts.stockChart('container', {
						rangeSelector: {
							enabled: false
						},
						exporting: {
							enabled: false
						},
						scrollbar: {
							enabled: false
						},
						chart: {
							backgroundColor: "#313132",
							borderColor: "#335cad"
						},
						credits: {
							enabled: false,
						},
						title: {
							text: 'AIC价格走势',
							style: {
								"color": "#ffffff"
							}
						},
						xAxis: {
							labels: {
								style: {
									color: '#ffffff'
								}
							}
						},
						yAxis: {
							labels: {
								style: {
									color: '#ffffff'
								}
							},
							gridLineColor: "#777788"
						},
						series: [{
							id: '000001',
							name: '价格',
							color: '#2b908f',
							data: data
						}]
					});
				});
			});
			
			$(document).ready(function() {
				$("#currentPrice").toggle(function() {
						vm.priceBook = JSON.parse(plus.storage.getItem("priceBookUSD"));
						$("#currentPrice").text("$ "+ vm.priceBook.closePrice);
					},
					function() {
						vm.priceBook = JSON.parse(plus.storage.getItem("priceBook"));
						$("#currentPrice").text("￥"+ vm.priceBook.closePrice);
					}
				);
			});
		</script>
	</body>

</html>